#!/bin/sh

SIZE=`/usr/bin/du -k /var/log/snort/alert | /usr/bin/awk '{print $1}'`

if [ $? -ne 0 ]; then
    exit 1
fi

if [ $SIZE -gt 500 ]; then
    /bin/cat /var/log/snort/alert >> /var/log/snort/alert.bak
    /bin/cat /dev/null > /var/log/snort/alert
fi
